Total Complexity | 2 |
Total Lines | 15 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | 9 | import { Injectable } from '@nestjs/common'; |
|
5 | |||
6 | @Injectable() |
||
7 | 9 | export class CitiesService { |
|
8 | constructor( |
||
9 | @InjectRepository(City) |
||
10 | 8 | private readonly cityRepository: Repository<City>, |
|
11 | ) {} |
||
12 | |||
13 | async findAll(): Promise<City[]> { |
||
14 | 1 | return await this.cityRepository.find(); |
|
15 | } |
||
16 | |||
17 | async createCity(data?: Partial<City>): Promise<City> { |
||
18 | 1 | const city = this.cityRepository.create(data); |
|
19 | 1 | return await this.cityRepository.save(city); |
|
20 | } |
||
22 |